import request from "@/util/http";
import qs from "qs";

export default {
  //渲染页面接口
  gain(forms) {
    return request({
      method: "get",
      params: {
        _gp: "admin.user",
        _mt: "getUser",
        nickname: forms.inputName,
        pageNo: forms.pageNo,
        limit: forms.pageSize,
        id: forms.inputID,
        level: forms.levels,
        gender: forms.genders,
        status: forms.statuss
      }
    });
  },
  compile(forms) {
    return request({
      method: "post",
      data: qs.stringify({
        _gp: "admin.user",
        _mt: "updateUser",
        user: JSON.stringify({
          nickname: forms.nickname,
          phone: forms.phone,
          level: forms.level,
          gender: forms.gender,
          status: forms.status,
          password: forms.password,
          id: forms.id
        })
      })
    });
  },
  //删除接口
  cancel(forms) {
    return request({
      method: "post",
      data: qs.stringify({
        _gp: "admin.user",
        _mt: "deleteUser",
        id: forms.id,
        nickname: forms.nickname
      })
    });
  },
  //冻结
  state(id, status) {
    return request({
      method: "post",
      data: qs.stringify({
        _gp: "admin.user",
        _mt: "updateStatus",
        userId: id,
        status: status
      })
    });
  }
};
